import api from './index'

// 案件相关API
export const caseApi = {
  // 获取案件列表
  getCaseList: (params) => api.get('/cases', { params }),
  
  // 获取案件详情
  getCaseDetail: (caseId) => api.get(`/cases/${caseId}`),
  
  // 创建案件
  createCase: (data) => api.post('/cases', data),
  
  // 更新案件
  updateCase: (caseId, data) => api.put(`/cases/${caseId}`, data),
  
  // 删除案件
  deleteCase: (caseId) => api.delete(`/cases/${caseId}`),
  
  // 获取案件统计
  getCaseStats: () => api.get('/cases/stats'),
  
  // 上传案件材料
  uploadCaseMaterial: (caseId, formData) => api.post(`/cases/${caseId}/materials`, formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }),
  
  // 获取案件时间轴
  getCaseTimeline: (caseId) => api.get(`/cases/${caseId}/timeline`),
  
  // 更新案件状态
  updateCaseStatus: (caseId, status) => api.patch(`/cases/${caseId}/status`, { status }),
  
  // 分配律师
  assignLawyer: (caseId, lawyerId) => api.post(`/cases/${caseId}/assign`, { lawyerId }),
  
  // 获取案件文件
  getCaseFiles: (caseId) => api.get(`/cases/${caseId}/files`),
  
  // 下载案件文件
  downloadCaseFile: (caseId, fileId) => api.get(`/cases/${caseId}/files/${fileId}/download`),
  
  // 案件审批
  approveCase: (caseId, approvalData) => api.post(`/cases/${caseId}/approve`, approvalData),
  
  // 案件归档
  archiveCase: (caseId) => api.post(`/cases/${caseId}/archive`),
  
  // 获取待办案件
  getPendingCases: () => api.get('/cases/pending'),
  
  // 获取进行中案件
  getInProgressCases: () => api.get('/cases/in-progress'),
  
  // 获取已结案案件
  getClosedCases: () => api.get('/cases/closed')
} 